home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.awt;
-
- import java.io.IOException;
- import symantec.itools.db.pro.ProjBinder;
- import symantec.itools.db.pro.ProjLink;
- import symantec.itools.db.pro.RelationView;
- import symjava.sql.SQLException;
-
- public class Label extends java.awt.Label implements ProjLink {
- private ProjBinder m_ProjBinder;
- private String m_labelText;
- private int m_treatBlankAs;
- private boolean m_DynamicUpdate = false;
-
- public Label() {
- super("<dbAWARE Label>");
- }
-
- public Label(String s) {
- this.m_labelText = s;
- }
-
- public void setBinding(RelationView relView, String projection) {
- try {
- int projectionNumber = relView.findProjByName(projection);
- relView.bindProj(projectionNumber, this);
- } catch (SQLException Ex) {
- this.raiseException("SQLException from Label.setBinding: " + ((Throwable)Ex).getMessage());
- }
- }
-
- public void init(ProjBinder binder) {
- this.m_ProjBinder = binder;
- }
-
- public void notifyDataChange(ProjBinder binder) {
- if (binder != null) {
- this.m_ProjBinder = binder;
- }
-
- String data = new String();
-
- try {
- if (binder.isReadable() && !binder.isNull()) {
- data = binder.getStringValue();
- }
- } catch (SQLException Ex) {
- this.raiseException("SQLException from Label.notifyDataChange: " + ((Throwable)Ex).getMessage());
- } catch (IOException Ex) {
- this.raiseException("IOException from Label.notifyDataChange: " + ((Throwable)Ex).getMessage());
- }
-
- if (data.equals("")) {
- data = this.m_labelText;
- }
-
- ((java.awt.Label)this).setText(data);
- }
-
- public boolean notifySetData(ProjBinder binder) throws SQLException {
- return true;
- }
-
- public void setTreatBlankAs(String blank) {
- if ((new String(blank)).toUpperCase().equals("DEFAULT")) {
- this.m_treatBlankAs = 0;
- } else if ((new String(blank)).toUpperCase().equals("NULL")) {
- this.m_treatBlankAs = 1;
- } else {
- if ((new String(blank)).toUpperCase().equals("EMPTY")) {
- this.m_treatBlankAs = 2;
- }
-
- }
- }
-
- void raiseException(String text) {
- System.out.println(text);
- }
-
- public void setDynamicUpdate(boolean update) {
- this.m_DynamicUpdate = update;
- }
- }
-